<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/amazeui.min.css" />
		<link rel="stylesheet" href="css/admin.css" />
	</head>
	<script>
		var msg = '${msg}';
		if(msg!=''){
			alert(msg);
			window.location.href="leave";
		}
	</script>
	<body>
		<div class="admin-content-body">
			<div class="am-cf am-padding am-padding-bottom-0">
				<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">请假管理</strong><small></small></div>
			</div>

			<hr>

			<div class="am-g">
				<div class="am-u-sm-12 am-u-md-6">
					<div class="am-btn-toolbar">
						<div class="am-btn-group am-btn-group-xs">
							<button type="button" class="am-btn am-btn-default btnAdd"><span class="am-icon-plus"></span>申请请假</button>
							<button type="button" onclick="javascript:window.location.href='leave?eid='+${emp.eid}" style="margin-left: 20px;" class="am-btn am-btn-default btnFindNotes"><span class="am-icon-archive"></span> 请假记录 </button>
							<button type="button" style="margin-left: 20px;" class="am-btn am-btn-default btnFindNoCheck"><span class="am-icon-archive"></span> 待审批</button>
							<button type="button" style="margin-left: 20px;" class="am-btn am-btn-default btnFindCheck"><span class="am-icon-archive"></span> 已审批 </button>
						</div>
					</div>
				</div>
			</div>
			<div class="am-g">
				<div class="am-u-sm-12">
					<form class="am-form">
						<table class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>
									<th class="table-check"><input type="checkbox" id="chkAll"></th>
									<th class="table-id" style="width:100px;">ID</th>
									<th class="table-title">申请人</th>
									<th class="table-title">请假标题</th>
									<th class="table-type">事由说明</th>
									<th class="table-dname">请假开始日期</th>
									<th class="table-role">请假结束日期</th>
									<th class="table-role">主管审批状态</th>
									<th class="table-set">操作</th>
								</tr>
							</thead>
							<tbody>
							<c:forEach items="${notes.list}" var="note">
								<tr>
									<td><input type="checkbox" name="chk"></td>
									<td>${note.nid}</td>
									<td>${note.e.realname}</td>
									<td>${note.title}</td>
									<td>${note.context}</td>
									<td class="am-hide-sm-only"><span class="am-badge  am-badge-danger ">${note.startdate}</span></td>
									<td>${note.enddate}</td>
									<c:if test="${note.estatus == 0}">
										<td>待审核</td>
									</c:if>
									<c:if test="${note.estatus == 1}">
										<td>同意</td>
									</c:if>
									<c:if test="${note.estatus == 2}">
										<td>打回</td>
									</c:if>
									<c:if test="${note.estatus == 3}">
										<td>不同意</td>
									</c:if>
									<c:if test="${emp.position != 2}">
										<td>
											<div class="am-btn-toolbar">
												<div class="am-btn-group am-btn-group-xs">
													<button onclick="javascript:window.location.href='check?estatus=1&eid='+${note.eid}" type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary btnedit">
														<span class="am-icon-pencil-square-o"></span>
														同意
													</button>
													<button type="button" class="am-btn am-btn-default am-btn-xs am-text-danger amt-hide-sm-only" onclick="javascript:window.location.href='check?estatus=2&eid='+${note.eid}">
														<span class="am-icon-trash-o"></span>
														打回
													</button>
													<button onclick="javascript:window.location.href='check?estatus=3&eid='+${note.eid}" type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary btnedit">
														<span class="am-icon-pencil-square-o"></span>
														不同意
													</button>
												</div>
											</div>
										</td>
									</c:if>
									<c:if test="${emp.position == 2}">
										<td>没有权限</td>
									</c:if>
								</tr>
							</c:forEach>
							</tbody>
						</table>
						<div class="am-cf" style="margin-right: 30px;">
							共 ${notes.total} 条记录
							<div class="am-fr">
								<ul class="am-pagination">
									<c:if test="${!notes.hasPreviousPage}">
										<li class="am-disabled">
											<a href="#">«</a>
										</li>
									</c:if>
									<c:if test="${notes.hasPreviousPage}">
										<li>
											<a href="leave?pageNum=${notes.pageNum-1}">«</a>
										</li>
									</c:if>
									<c:forEach items="${notes.navigatepageNums}" var="page">
										<c:if test="${notes.pageNum == page}">
											<li class="am-active">
												<a href="#">${page}</a>
											</li>
										</c:if>
										<c:if test="${notes.pageNum != page}">
											<li>
												<a href="leave?pageNum=${page}">${page}</a>
											</li>
										</c:if>
									</c:forEach>
									<c:if test="${!notes.hasNextPage}">
										<li class="am-disabled">
											<a href="#">»</a>
										</li>
									</c:if>
									<c:if test="${notes.hasNextPage}">
										<li>
											<a href="leave?pageNum=${notes.pageNum+1}">»</a>
										</li>
									</c:if>
								</ul>
							</div>
						</div>
						<hr>
					</form>
				</div>
			</div>
		</div>

		<script type="text/javascript" src="js/jquery-1.11.3.min.js" ></script>
		<script type="text/javascript" src="myplugs/js/plugs.js" ></script>
		<script>
			$(function() {
				$(".btnAdd").click(function() {
					$.jq_Panel({
						title: "申请请假",
						iframeWidth: 600,
						iframeHeight: 560,
						url: "addLeave.jsp?eid="+${emp.eid}
					});
				});
			});
		</script>
	</body>

</html>
